Conversation
Signed-off-by: Kurt Roekle <k_roekle@apple.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a new Gradle :cli module (regoj) that provides a local-only command-line driver for the Java OPA SDK, intended for developer testing and benchmarking (and explicitly excluded from Maven Central publication).
Changes:
- Adds
:climodule wiring, build config, and a README documenting local/testing-only usage. - Implements an
evalsubcommand (picocli) that loads plan bundles (dir or.tar.gz), evaluates an entrypoint, and can emit metrics/trace/profile/coverage output. - Adds JUnit tests + bundled test resources to validate core CLI behavior and outputs; updates
.gitignorefor.out/.
Reviewed changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| settings.gradle.kts | Includes the new cli module in the multi-module build. |
| build.gradle.kts | Skips Maven publish plugin/config for :cli to avoid publishing. |
| .gitignore | Ignores .out/ artifacts. |
| cli/build.gradle.kts | Adds application module build config + dependencies + run task settings. |
| cli/README.md | Documents regoj usage, flags, and local-only warning. |
| cli/src/main/java/io/github/open_policy_agent/opa/cli/Regoj.java | CLI entrypoint wiring for picocli. |
| cli/src/main/java/io/github/open_policy_agent/opa/cli/Eval.java | Implements eval command: bundle load, evaluation loop, output + reporting. |
| cli/src/main/java/io/github/open_policy_agent/opa/cli/Format.java | Shared formatting helpers (durations, file references). |
| cli/src/main/java/io/github/open_policy_agent/opa/cli/MetricsReporter.java | Renders single-run vs statistical metrics tables. |
| cli/src/main/java/io/github/open_policy_agent/opa/cli/TraceReporter.java | Renders statement enter/exit trace output. |
| cli/src/main/java/io/github/open_policy_agent/opa/cli/ProfileReporter.java | Renders per-location profiling tables (single/statistical). |
| cli/src/main/java/io/github/open_policy_agent/opa/cli/StatementReporter.java | Renders per-statement profiling tables (single/statistical). |
| cli/src/main/java/io/github/open_policy_agent/opa/cli/CoverageReporter.java | Renders per-file covered-line ranges. |
| cli/src/test/java/io/github/open_policy_agent/opa/cli/CliTest.java | End-to-end-ish tests for CLI flags, output formats, and reports. |
| cli/src/test/resources/input.json | Test input document. |
| cli/src/test/resources/ir_simple_dir/.manifest | Bundle manifest for test plan directory. |
| cli/src/test/resources/ir_simple_dir/data.json | Bundle data for tests. |
| cli/src/test/resources/ir_simple_dir/plan.json | Compiled plan bundle used by tests. |
| cli/src/test/resources/ir_simple_dir/simple.rego | Source rego file referenced by the plan and used for coverage/trace. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Kurt Roekle <k_roekle@apple.com>
Signed-off-by: Kurt Roekle <k_roekle@apple.com>
Signed-off-by: Kurt Roekle <k_roekle@apple.com>
Signed-off-by: Kurt Roekle <k_roekle@apple.com>
Signed-off-by: Kurt Roekle <k_roekle@apple.com>
Signed-off-by: Kurt Roekle <k_roekle@apple.com>
sspaink
approved these changes
Jun 11, 2026
sspaink
left a comment
Member
There was a problem hiding this comment.
lgtm, tried it out locally and works as the readme describes 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new
:cliGradle module (regoj) — a small command-line driver for the SDK intended for local testing and benchmarking only. It is explicitly excluded from Maven Central publication and the README carries a prominent warning directing users to the official OPA CLI for production workflows.Why
We need a quick way to load plan bundles, evaluate entrypoints, and inspect metrics/traces/profiles/coverage when developing and benchmarking the SDK, without standing up a full host application each time.
What's included
climodule wired into the multi-module build, using picocli for arg parsing and commons-compress for tarball bundles.evalsubcommand supporting:.tar.gz/.tgzplan bundles or unpacked directories (repeatable-b)-i) or stdin (-I)json/prettyoutput--metrics/--instrument,--profile(with--profile-limit,--profile-sort),--coverage,--explain--fail/--fail-definedfor shell exit-code gating--countfor repeated runs with min/max/mean/p90/p99 reporting;--count-includes-loadto include bundle load/engine build per iteration--capabilities-currentto dump registered builtin capabilitiesprint()output forwarded to stderr.com.vanniktech.maven.publishconfiguration for:cliso it is not published..gitignoreupdates for.out/.